class Solution {
public:
    bool containsDuplicate(vector<int>& nums) {
        sort(nums.begin(),nums.end());
        auto it=nums.begin();
        while(it+1!=nums.end()){
            if(*it==*(it+1)){
                return true;
            }
            it++;
        }
        return false;
    }
};
